// --------------------------------------------------------------------------------------------------------------------
// <copyright file="RobotiqSModelMasks.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Microsoft.Robotics.Hardware.Robotiq
{
    using System.Runtime.Serialization;

    /// <summary>
    /// Grip status available on Robotiq S Model gripper.
    /// </summary>
    [DataContract]
    public static class RobotiqSModelValues
    {
        /// <summary>
        /// Mask for activation bits
        /// </summary>
        public const byte ActivationMask = 0x01;

        /// <summary>
        /// Indicates that gripper is activated.  Contained in feedback register 0.
        /// </summary>
        public const byte GripperActivated = 0x01;

        /// <summary>
        /// Mask for grip mode
        /// </summary>
        public const byte GripModeMask = 0x06;

        /// <summary>
        /// Indicates that gripper is in basic mode.  Contained in feedback register 0.
        /// </summary>
        public const byte BasicMode = 0x00;

        /// <summary>
        /// Indicates that gripper is in pinch mode.  Contained in feedback register 0.
        /// </summary>
        public const byte PinchMode = 0x02;

        /// <summary>
        /// Indicates that gripper is in wide mode.  Contained in feedback register 0.
        /// </summary>
        public const byte WideMode = 0x04;

        /// <summary>
        /// Indicates that gripper is in scissor mode.  Contained in feedback register 0.
        /// </summary>
        public const byte ScissorMode = 0x06;

        /// <summary>
        /// Go to position bit mask
        /// </summary>
        public const byte GoToPositionMask = 0x08;

        /// <summary>
        /// Indicates that the "go to position" bit has been set.  Contained in feedback register 0.
        /// </summary>
        public const byte GoToPositionActive = 0x08;

        /// <summary>
        /// Mask for the status bits
        /// </summary>
        public const byte GripperStatusMask = 0x30;

        /// <summary>
        /// Indicates that gripper requires reset.  Contained in feedback register 0.
        /// </summary>
        public const byte Reset = 0x00;

        /// <summary>
        /// Indicates that gripper activation is in progress.  Contained in feedback register 0.
        /// </summary>
        public const byte ActivationInProgress = 0x10;

        /// <summary>
        /// Indicates that a gripper mode change is in progress.  Contained in feedback register 0.
        /// </summary>
        public const byte ModeChangeInProgress = 0x20;

        /// <summary>
        /// Indicates that mode change and activation are complete.  Contained in feedback register 0.
        /// </summary>
        public const byte ActivationAndModeChangeComplete = 0x30;

        /// <summary>
        /// Mask for grip status bits
        /// </summary>
        public const byte GripStatusMask = 0xC0;

        /// <summary>
        /// Indicates that the gripping motion is in progress.
        /// Contained in feedback register 0.
        /// </summary>
        public const byte GripperInMotion = 0x00;

        /// <summary>
        /// Indicates that the gripping motion is stopped, and one or two fingers stopped before reaching target position.
        /// Contained in feedback register 0.
        /// </summary>
        public const byte OneOrTwoFingersStoppedBeforeReference = 0x40;

        /// <summary>
        /// Indicates that the gripping motion is stopped, and all fingers stopped before reaching target position.
        /// Contained in feedback register 0.
        /// </summary>
        public const byte AllFingersStoppedBeforeReference = 0x80;

        /// <summary>
        /// Indicates that the gripping motion is stopped, and all fingers reached their target positions.
        /// Contained in feedback register 0.
        /// </summary>
        public const byte AllFingersReachedReference = 0xC0;

        /// <summary>
        /// Mask for finger status bits
        /// </summary>
        public const byte FingerStatusMask = 0x03;

        /// <summary>
        /// Indicates that a finger is in motion
        /// 2 bits of register 1 are used for each of the three fingers and the scissor axis.
        /// </summary>
        public const byte FingerInMotion = 0x00;

        /// <summary>
        /// Indicates that a finger has stopped due to contact while opening.
        /// 2 bits of register 1 are used for each of the three fingers and the scissor axis.
        /// </summary>
        public const byte FingerHasStoppedDueToContactWhileOpening = 0x01;

        /// <summary>
        /// Indicates that a finger has stopped due to contact while closing.
        /// 2 bits of register 1 are used for each of the three fingers and the scissor axis.
        /// </summary>
        public const byte FingerHasStoppedDueToContactWhileClosing = 0x02;

        /// <summary>
        /// Indicates that a finger has stopped at requested position.
        /// 2 bits of register 1 are used for each of the three fingers and the scissor axis.
        /// </summary>
        public const byte FingerIsAtRequestedPosition = 0x03;
    }
}
